<IMG SRC="hugo.gif" ALT='hugo'>to set the attribute
SRC
to ``hugo.gif
'' and
ALT
to ``hugo
''. The first assignment uses double
quotes to denote the string boundaries, the second one uses single
quotes. There is no difference in the functionality between these to
kinds of quotes.
Again, like in html, one kind of quotes might show up inside a string, as long as it is quoted with other kind, for example:
<IMG SRC="quote.gif" ALT='"'>
Now ALT
contains a double quote as value.
<IMG SRC=hugo.gif ALT=hugo>is also legal. As this can cause problems with (very) old browsers, it might result in message #22, if hsc is configured to. However, the following is not allowed according to the specifications of html:
<IMG SRC=image/hugo.gif ALT=hugo>
Because of the slash (``/
'') in the value of SRC
, it would
have been required to put it inside quotes. As this is not the case,
message #81 will show up. Although most browsers can cope with
this, and will use a white space or a greater-than (``>
'') as delimiter,
this behavior is not standard.
When the assigned value starts with a bracket (``(
''), it denotes an
expression to be computed before its result is used as new value.
There are several operators you can use for that, and of course you
also can refer to other attributes.
<IMG SRC=(name+".gif") ALT=(name)>If the attribute
name
has been set to ``sepp
'' before,
this will result in
<IMG SRC="sepp.gif" ALT="sepp">
The ``+
'' is used to concatenate two values together.
This paragraph deals with a feature you probably do not want to use (and understand) before you understood how those macros work. You can skip this part for now and return later.
You can easily let an attribute obtain it's value from another attribute. For example, within a tag call you can use an assignment likesepp=(hugo)However, if
hugo
has not been defined and assigned a
value before, this will result in an error message. Conditional
assignments now only assign a value to the target attribute, if the
source attribute has been set; in any case, the source attribute must
have been defined before (using <$macro>
or <$define>
).
Simply use a ``?=
'' instead of the ``=
'' assignment
operator:
sepp?=hugoThis becomes handy for such macros which are more or less only extensions of real html-tags:
<$macro MY-BODY BackGround:uri> <BODY BackGround?=BackGround"> </$macro>
The macro <MY-BODY>
just inserts a <BODY>
tag. But
optionally it can also handle the attribute
BackGround
.
But there has not necessarily a BackGround
attribute to
be set when calling <MY-BODY>
. If you do not specify any,
there also will not be one in the call to <BODY>
after
the macro has been processed.
<MY-BODY>will result in
<BODY>but a
<MY-BODY BackGround='image/backgr.png'>will lead to
<BODY BackGround="image/backgr.png">thus in the second case also adding the attribute
BackGround
to the <BODY>
-tag.
If <MY-BODY>
would have been declared without conditional
assignment, it could have looked something like:
<$macro MY-BODY BackGround:uri> <BODY BackGround=(BackGround)> </$macro>If you would try to call it without a
BackGround
passed,
this attribute would have been unset, and the attempt to copy the
value of BackGround/MY-BODY
to
BackGround/BODY
using
BackGround=(BackGround)
would result in message #23
On the first sight, it might seem that there is only the simple condition ``if attribute is set..'' is possible. But no one prevents you from using code like this:
<$define TEXT:color> <$if COND=(awfully complex condition))> <$let TEXT='#123456'> </$if> <MY-BODY TEXT?=TEXT>This also works for
<$let>
:
<$define sepp:string> <$define hugo:string> <$if COND=(awfully complex condition)> <$let hugo="hugo-value"> </$if> <$let sepp?=hugo>and you can also use expressions to compute the source attribute. For instance, the last line of the above example also could have been
<$let sepp?=("hu"+"go")>